home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Term::ReadLine.Z / Term::ReadLine
Encoding:
Text File  |  1998-10-28  |  7.8 KB  |  265 lines

  1.  
  2.  
  3.  
  4.      TTTTeeeerrrrmmmm::::::::RRRReeeeaaaaddddLLLLiiiinnnneeee((((3333))))22223333////JJJJuuuullll////99998888    ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))TTTTeeeerrrrmmmm::::::::RRRReeeeaaaaddddLLLLiiiinnnneeee((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       Term::ReadLine - Perl    interface to various readline
  10.       packages. If no real package is found, substitutes stubs
  11.       instead of basic functions.
  12.  
  13.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  14.         use    Term::ReadLine;
  15.         $term = new    Term::ReadLine 'Simple Perl calc';
  16.         $prompt = "Enter your arithmetic expression: ";
  17.         $OUT = $term->OUT || STDOUT;
  18.         while ( defined ($_    = $term->readline($prompt)) ) {
  19.           $res = eval($_), "\n";
  20.           warn $@ if $@;
  21.           print $OUT $res, "\n" unless $@;
  22.           $term->addhistory($_) if /\S/;
  23.         }
  24.  
  25.  
  26.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  27.       This package is just a front end to some other packages. At
  28.       the moment this description is written, the only such
  29.       package is Term-ReadLine, available on CPAN near you.    The
  30.       real target of this stub package is to set up    a common
  31.       interface to whatever    Readline emerges with time.
  32.  
  33.      MMMMiiiinnnniiiimmmmaaaallll sssseeeetttt ooooffff ssssuuuuppppppppoooorrrrtttteeeedddd ffffuuuunnnnccccttttiiiioooonnnnssss
  34.       All the supported functions should be    called as methods,
  35.       i.e.,    either as
  36.  
  37.         $term = new    Term::ReadLine 'name';
  38.  
  39.       or as
  40.  
  41.         $term->addhistory('row');
  42.  
  43.       where    $term is a return value    of Term::ReadLine->Init.
  44.  
  45.       ReadLine    returns the actual package that executes the
  46.               commands.    Among possible values are
  47.               Term::ReadLine::Gnu, Term::ReadLine::Perl,
  48.               Term::ReadLine::Stub Exporter.
  49.  
  50.       new          returns the handle for subsequent    calls to
  51.               following    functions. Argument is the name    of the
  52.               application. Optionally can be followed by two
  53.               arguments    for IN and OUT filehandles. These
  54.               arguments    should be globs.
  55.  
  56.       readline    gets an input line, _p_o_s_s_i_b_l_y with    actual
  57.               readline support.    Trailing newline is removed.
  58.               Returns undef on EOF.
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      TTTTeeeerrrrmmmm::::::::RRRReeeeaaaaddddLLLLiiiinnnneeee((((3333))))22223333////JJJJuuuullll////99998888    ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))TTTTeeeerrrrmmmm::::::::RRRReeeeaaaaddddLLLLiiiinnnneeee((((3333))))
  71.  
  72.  
  73.  
  74.       addhistory  adds the line to the history of input, from
  75.               where it can be used if the actual readline is
  76.               present.
  77.  
  78.       IN, $OUT    return the filehandles for input and output or
  79.               undef if readline    input and output cannot    be
  80.               used for Perl.
  81.  
  82.       MinLine     If argument is specified,    it is an advice    on
  83.               minimal size of line to be included into
  84.               history.    undef means do not include anything
  85.               into history. Returns the    old value.
  86.  
  87.       findConsole returns an array with two    strings    that give most
  88.               appropriate names    for files for input and    output
  89.               using conventions    "<$in",    ">out".
  90.  
  91.       Attribs     returns a    reference to a hash which describes
  92.               internal configuration of    the package. Names of
  93.               keys in this hash    conform    to standard
  94.               conventions with the leading rl_ stripped.
  95.  
  96.       Features    Returns a    reference to a hash with keys being
  97.               features present in current implementation.
  98.               Several optional features    are used in the
  99.               minimal interface: appname should    be present if
  100.               the first    argument to new    is recognized, and
  101.               minline should be    present    if MinLine method is
  102.               not dummy.  autohistory should be    present    if
  103.               lines are    put into history automatically (maybe
  104.               subject to MinLine), and addhistory if
  105.               addhistory method    is not dummy.
  106.  
  107.               If Features method reports a feature attribs as
  108.               present, the method Attribs is not dummy.
  109.  
  110.      AAAAddddddddiiiittttiiiioooonnnnaaaallll    ssssuuuuppppppppoooorrrrtttteeeedddd ffffuuuunnnnccccttttiiiioooonnnnssss
  111.       Actually Term::ReadLine can use some other package, that
  112.       will support reacher set of commands.
  113.  
  114.       All these commands are callable via method interface and
  115.       have names which conform to standard conventions with    the
  116.       leading rl_ stripped.
  117.  
  118.       The stub package included with the perl distribution allows
  119.       some additional methods:
  120.  
  121.       tkRunning   makes Tk event loop run when waiting for user
  122.               input (i.e., during readline method).
  123.  
  124.       ornaments   makes the    command    line stand out by using
  125.               termcap data.  The argument to ornaments should
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      TTTTeeeerrrrmmmm::::::::RRRReeeeaaaaddddLLLLiiiinnnneeee((((3333))))22223333////JJJJuuuullll////99998888    ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))TTTTeeeerrrrmmmm::::::::RRRReeeeaaaaddddLLLLiiiinnnneeee((((3333))))
  137.  
  138.  
  139.  
  140.               be 0, 1, or a string of a    form "aa,bb,cc,dd".
  141.               Four components of this string should be names
  142.               of _t_e_r_m_i_n_a_l _c_a_p_a_c_i_t_i_e_s, first two    will be    issued
  143.               to make the prompt standout, last    two to make
  144.               the input    line standout.
  145.  
  146.       newTTY      takes two    arguments which    are input filehandle
  147.               and output filehandle.  Switches to use these
  148.               filehandles.
  149.  
  150.       One can check    whether    the currently loaded ReadLine package
  151.       supports these methods by checking for corresponding
  152.       Features.
  153.  
  154.      EEEEXXXXPPPPOOOORRRRTTTTSSSS
  155.       None
  156.  
  157.      EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT
  158.       The envrironment variable PERL_RL governs which ReadLine
  159.       clone    is loaded. If the value    is false, a dummy interface is
  160.       used.    If the value is    true, it should    be tail    of the name of
  161.       the package to use, such as Perl or Gnu.
  162.  
  163.       As a special case, if    the value of this variable is space-
  164.       separated, the tail might be used to disable the ornaments
  165.       by setting the tail to be o=0    or ornaments=0.     The head
  166.       should be as described above,    say
  167.  
  168.       If the variable is not set, or if the    head of    space-
  169.       separated list is empty, the best available package is
  170.       loaded.
  171.  
  172.         export "PERL_RL=Perl o=0"      # Use    Perl ReadLine without ornaments
  173.         export "PERL_RL= o=0"      # Use    best available ReadLine    without    ornaments
  174.  
  175.       (Note    that processing    of PERL_RL for ornaments is in the
  176.       discretion of    the particular used Term::ReadLine::*
  177.       package).
  178.  
  179.       no real package is found, substitutes    stubs instead of basic
  180.       functions."
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                        (printed 10/23/98)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      TTTTeeeerrrrmmmm::::::::RRRReeeeaaaaddddLLLLiiiinnnneeee((((3333))))22223333////JJJJuuuullll////99998888    ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))TTTTeeeerrrrmmmm::::::::RRRReeeeaaaaddddLLLLiiiinnnneeee((((3333))))
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.      Page 4                        (printed 10/23/98)
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.